#ifndef __EPSILON__STL_H__
#define __EPSILON__STL_H__


#ifdef _MSC_VER
#  pragma warning( disable : 4786 ) // Mangled STL names are too long for browse maps...
#else
#  define __forceinline inline
#endif


#define eSTL_IterValid(iter,end) (iter != end)
#define eSTL_IterValidEx(iter,end) ((iter != NULL) && (iter != end))

namespace eSTL
{
  template <class Type>
    __forceinline bool 
      IterValid (Type iter, Type end) {
//#define CMOV_HACK
#ifdef CMOV_HACK
    bool valid = (end - iter);

    return valid;
#else
#ifndef NULL
#define NULL 0
#endif
    //if (iter != end)
///    return ((NULL != *((int *)&iter)) & (iter != end)); /// Causes compiler warning on gcc.
    return ((0 != *((int *)&iter)) & (iter != end));

    /*
    if (iter != NULL && iter != end)
      return true;

    return false;
    */
#endif
  }

  template <class Type>
    __forceinline bool 
      IterValidEx (Type iter, Type end) {
//#define CMOV_HACK
#ifdef CMOV_HACK
    bool valid = (iter != NULL) * (end - iter);

    return valid;
#else
    if (iter && iter != end)
      return true;

    return false;
#endif
  }
}


//
// Special considerations for non-debug (Release) builds only
//
#ifdef _MSC_VER
#  ifndef _DEBUG
#    pragma warning( disable : 4530 ) // STL uses exception handling, but some apps disable it...
#  endif
#endif


#endif /* __EPSILON__STL_H__ */
